package edu.sctu.practice.class01.nieyu.assign04;

/**
 * Created by Administrator on 2015/12/7.
 */
public class ExampleOfString {
    public static void main(String[] args) {

        String stringOne = "老大";
        String stringTwo = "老三";
        String stringThree = "最小的是老三";

        if (stringOne.equals(stringTwo)){

            System.out.println("两字符串相同");
        }else {

            System.out.println("两字符串不相同");
        }

        if (stringThree.startsWith("老")){

            System.out.println("stringThree和stringOne的前缀相同");
        }else {

            System.out.println("stringThree和stringOne的前缀不相同");
        }

        if (stringOne.compareTo(stringTwo) > 0){

            System.out.println("按字典序stringOne大于stringTwo");
        }else {

            System.out.println("按字典序stringOne小于stringTwo");
        }
    }
}
